level: beginner
What is Eddie?
Eddie is a new code editor written in Liberty BASIC, for Liberty BASIC. Eddie can be customized and extended to meet the needs of the individual programmer. The newest version is available here: Eddie!
Eddie's Lessons This Month:
Altering Eddie's Window to Add Controls
In version 3 of Eddie, we located and sized the graphicbox and the texteditor very carefully, so that they would autoresize correctly when the user changed the size of the window. This version adds a combobox to hold the list of branch labels. To accomodate the combobox, we'll locate the graphicbox and texteditor downwards a few pixels, and we'll give them a height that is a few pixels less:
'version 3 graphicbox #1.g, 0, 22, 39, 260 texteditor #1.te, 39, 22, 545, 280
For version 4, we move the graphicbox and texteditor from y=22 to y=52. This leaves room to put a combobox above the texteditor. We also reduce the height of both controls by 30 pixels:
graphicbox #1.g, 0, 52, 39, 230 texteditor #1.te, 39, 52, 545, 250 combobox #1.c, branch$(),[chooseBranch],40,22,385,300
Eddie v4 looks like this:

Combobox Height
Comboboxes are odd controls. The commands to create other controls have parameters for the left X location, the top Y location, the width and the height of the control on the window. The combobox command requires X, Y, width and height, but the height parameter does not refer to the height of the visible control. It refers to the height of the drop-down list. The height of the visible portion of the control is governed by the font used.
Look at these two comboboxes:

Both are created with a height of 300. The bottom one appears to be much larger on the window. That is because it has received a FONT command that gives it a larger font than the top combobox. To alter the height of the visible portion of the combobox, we must change the font. All controls use the default GUI font face and size for the desktop theme in use. If we give the window a FONT command, all controls will use that font instead. Individual controls can receive FONT commands that override the Windows default font and the font command we issue to a window in our code. We discussed fonts at length in the lessons for Eddie, version 3. Here are the font commands for the little demo. The window font command is overridden by the control font commands for the two comboboxes.
#main "font ms_sans_serif 8"
#main.combo1 "font ms_sans_serif 10"
#main.combo2 "font ms_sans_serif 20"
Here's the full code for the little demo.
DIM Combo1$(10)
Combo1$(1) = "First Item"
Combo1$(2) = "Second Item"
DIM Combo2$(10)
Combo2$(1) = "First Item"
Combo2$(2) = "Second Item"
[WindowSetup]
NOMAINWIN
WindowWidth = 306 : WindowHeight = 121
UpperLeftX = INT((DisplayWidth-WindowWidth)/2)
UpperLeftY = INT((DisplayHeight-WindowHeight)/2)
[ControlSetup]
combobox #main.combo1,Combo1$(),[combo1.click], 25, 10, 205, 300
combobox #main.combo2,Combo2$(),[combo2.click], 25, 45, 205, 300
Open "Window Title" for Window as #main
#main "trapclose [quit]"
#main.combo1 "selectindex 1"
#main.combo2 "selectindex 1"
#main "font ms_sans_serif 8"
#main.combo1 "font ms_sans_serif 10"
#main.combo2 "font ms_sans_serif 20"
[loop]
Wait
[quit]
close #main : END
[combo1.click]
#main.combo1 "selection? selected$"
wait
[combo2.click]
#main.combo2 "selection? selected$"
wait
Eddie's Combobox Height
Since we haven't issued a separate FONT command to the combobox, it uses the font we set in the window FONT command:
'set the font for the window and controls
#1 "font ms_sans_serif 10"